//
//  YIem_SY_One_Center_VIew.m
//  B段_开眼
//
//  Created by YIem on 16/5/6.
//  Copyright © 2016年 Howie. All rights reserved.
//

#import "YIem_SY_One_Center_VIew.h"
#import "YIem_SY_One_Model.h"
@interface YIem_SY_One_Center_VIew ()

@property (nonatomic, strong) UILabel *labelTitle;
@property (nonatomic, strong) UILabel *labelDes;
@property (nonatomic, strong) UILabel *labelTitle1;
@property (nonatomic, strong) UILabel *labelDes1;
@property (nonatomic, strong) UILabel *labelTitle2;
@property (nonatomic, strong) UILabel *labelDes2;
@property (nonatomic, strong) UILabel *labelTitle3;
@property (nonatomic, strong) UILabel *labelDes3;
@property (nonatomic, strong) UILabel *labelTitle4;
@property (nonatomic, strong) UILabel *labelDes4;
@property (nonatomic, strong) UILabel *labelTitle5;
@property (nonatomic, strong) UILabel *labelDes5;

@end
@implementation YIem_SY_One_Center_VIew

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        self.labelTitle = [[UILabel alloc] init];
        self.labelTitle.textAlignment = NSTextAlignmentCenter;
        self.labelTitle.numberOfLines = 2;
//        self.labelTitle.backgroundColor = [UIColor redColor];
        [self addSubview:self.labelTitle];
        
        self.labelDes = [[UILabel alloc] init];
        self.labelDes.numberOfLines = 2;
//        self.labelDes.backgroundColor = [UIColor greenColor];
        [self addSubview:self.labelDes];
        
        self.labelTitle1 = [[UILabel alloc] init];
        self.labelTitle.numberOfLines = 2;
        self.labelTitle1.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.labelTitle1];
        
        self.labelDes1 = [[UILabel alloc] init];
        self.labelDes.numberOfLines = 2;
        [self addSubview:self.labelDes1];

        self.labelTitle2 = [[UILabel alloc] init];
        self.labelTitle.numberOfLines = 2;
        self.labelTitle2.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.labelTitle2];
        
        self.labelDes2 = [[UILabel alloc] init];
        self.labelDes.numberOfLines = 2;
        [self addSubview:self.labelDes2];

        self.labelTitle3 = [[UILabel alloc] init];
        self.labelTitle.numberOfLines = 2;
        self.labelTitle3.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.labelTitle3];
        
        self.labelDes3 = [[UILabel alloc] init];
        self.labelDes.numberOfLines = 2;
        [self addSubview:self.labelDes3];
        
        self.labelTitle4 = [[UILabel alloc] init];
        self.labelTitle.numberOfLines = 2;
        self.labelTitle4.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.labelTitle4];
        
        self.labelDes4 = [[UILabel alloc] init];
        self.labelDes.numberOfLines = 2;
        [self addSubview:self.labelDes4];
        
        self.labelTitle5 = [[UILabel alloc] init];
        self.labelTitle.numberOfLines = 2;
        self.labelTitle5.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.labelTitle5];
        
        self.labelDes5 = [[UILabel alloc] init];
        self.labelDes.numberOfLines = 2;
        [self addSubview:self.labelDes5];

    
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    // 1
    self.labelTitle.frame = CGRectMake(0, 0, self.frame.size.width / 4, self.frame.size.height / 6);
    self.labelDes.frame = CGRectMake(self.labelTitle.frame.size.width, 0, self.frame.size.width - self.labelTitle.frame.size.width, self.frame.size.height / 6);
    // 2
    self.labelTitle1.frame = CGRectMake(0, self.labelTitle.frame.origin.y + self.labelTitle.frame.size.height, self.frame.size.width / 4, self.frame.size.height / 6);
    self.labelDes1.frame = CGRectMake(self.labelTitle.frame.size.width, self.labelTitle.frame.origin.y + self.labelTitle.frame.size.height, self.frame.size.width - self.labelTitle.frame.size.width, self.frame.size.height / 6);
    // 3
    self.labelTitle2.frame = CGRectMake(0, self.labelTitle1.frame.origin.y + self.labelTitle1.frame.size.height, self.frame.size.width / 4, self.frame.size.height / 6);
    self.labelDes2.frame = CGRectMake(self.labelTitle.frame.size.width, self.labelTitle1.frame.origin.y + self.labelTitle1.frame.size.height, self.frame.size.width - self.labelTitle.frame.size.width, self.frame.size.height / 6);
    // 4
    self.labelTitle3.frame = CGRectMake(0, self.labelTitle2.frame.origin.y + self.labelTitle2.frame.size.height, self.frame.size.width / 4, self.frame.size.height / 6);
    self.labelDes3.frame = CGRectMake(self.labelTitle.frame.size.width, self.labelTitle2.frame.origin.y + self.labelTitle2.frame.size.height, self.frame.size.width - self.labelTitle.frame.size.width, self.frame.size.height / 6);
    // 5
    self.labelTitle4.frame = CGRectMake(0, self.labelTitle3.frame.origin.y + self.labelTitle3.frame.size.height, self.frame.size.width / 4, self.frame.size.height / 6);
    self.labelDes4.frame = CGRectMake(self.labelTitle.frame.size.width, self.labelTitle3.frame.origin.y + self.labelTitle3.frame.size.height, self.frame.size.width - self.labelTitle.frame.size.width, self.frame.size.height / 6);
    // 6
    self.labelTitle5.frame = CGRectMake(0, self.labelTitle4.frame.origin.y + self.labelTitle4.frame.size.height, self.frame.size.width / 4, self.frame.size.height / 6);
    self.labelDes5.frame = CGRectMake(self.labelTitle.frame.size.width, self.labelTitle4.frame.origin.y + self.labelTitle4.frame.size.height, self.frame.size.width - self.labelTitle.frame.size.width, self.frame.size.height / 6);
    

}

- (void)setArr:(NSMutableArray *)arr
{
    _arr = arr;
    
    YIem_SY_One_Model *model = [[YIem_SY_One_Model alloc ]init];

    
        self.labelTitle.text =[[arr objectAtIndex:0]title];
    self.labelTitle.textColor = [UIColor whiteColor];
        self.labelDes.text = [NSString stringWithFormat:@" %@  %@",[[arr objectAtIndex:0]tipt], [[arr objectAtIndex:0]zs]];
    self.labelDes.textColor = [UIColor whiteColor];
    self.labelTitle1.text =[[arr objectAtIndex:1]title];
    self.labelTitle1.textColor = [UIColor whiteColor];
    self.labelDes1.text = [NSString stringWithFormat:@" %@  %@",[[arr objectAtIndex:1]tipt], [[arr objectAtIndex:1]zs]];
    self.labelDes1.textColor = [UIColor whiteColor];
    self.labelTitle2.text =[[arr objectAtIndex:2]title];
    self.labelTitle2.textColor = [UIColor whiteColor];
    self.labelDes2.text = [NSString stringWithFormat:@" %@  %@",[[arr objectAtIndex:2]tipt], [[arr objectAtIndex:2]zs]];
    self.labelDes2.textColor = [UIColor whiteColor];
    self.labelTitle3.text =[[arr objectAtIndex:3]title];
    self.labelTitle3.textColor = [UIColor whiteColor];
    self.labelDes3.text = [NSString stringWithFormat:@" %@  %@",[[arr objectAtIndex:3]tipt], [[arr objectAtIndex:3]zs]];
    self.labelDes3.textColor = [UIColor whiteColor];
    self.labelTitle4.text =[[arr objectAtIndex:4]title];
    self.labelTitle4.textColor = [UIColor whiteColor];
    self.labelDes4.text = [NSString stringWithFormat:@" %@  %@",[[arr objectAtIndex:4]tipt], [[arr objectAtIndex:4]zs]];
    self.labelDes4.textColor = [UIColor whiteColor];
    self.labelTitle5.text =[[arr objectAtIndex:5]title];
    self.labelTitle5.textColor = [UIColor whiteColor];
    self.labelDes5.text = [NSString stringWithFormat:@" %@  %@",[[arr objectAtIndex:5]tipt], [[arr objectAtIndex:5]zs]];
    self.labelDes5.textColor = [UIColor whiteColor];
    

    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
